package com.lx.chong.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author chong
 * @create 2019/5/14
 * Desc: 用户信息
 */
@Entity
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class User implements Serializable {

    private static final long serialVersionUID = 3966504008108600098L;

    /**
     * 唯一标识符
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "Id")
    private Long id;

    /**
     * 账号/工号
     */
    @Column(name = "Account")
    private String account;

    /**
     * 密码 (只对反序列化生效)
     */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    @Column(name = "Password")
    private String password;

    /**
     * 姓名
     */
    @Column(name = "PerName")
    private String perName;

    /**
     * 手机号
     */
    @Column(name = "Mobile")
    private String mobile;

    /**
     * 邮箱
     */
    @Column(name = "Email")
    private String email;

    /**
     * 身份证号
     */
    @Column(name = "CitID")
    private String citID;

    /**
     * 微信openId
     */
    @Column(name = "OpenId")
    private String openId;
    /**
     * 性别（1：男性；2：女性）
     */
    @Column(name = "SexCode")
    private Integer sexCode;

    /**
     * 头像/照片
     */
    @Column(name = "Pic")
    private String pic;

    /**
     * 用户角色
     */
    @Column(name = "Role")
    private Integer role = 2;

    /**
     * 部门
     */
    @ManyToOne(fetch = FetchType.EAGER, optional = true)
    @JoinColumn(name = "DepId", insertable = true, unique = false)
    private Department department;


    /**
     * 添加/注册时间
     */
    @Column(name = "AddDateTime")
    private Date addDateTime;

    /**
     * 修改时间
     */
    @Column(name = "UpdateDateTime")
    private Date updateDateTime = new Date();

    /**
     * 删除标志位(0：未删除；1：删除)
     */
    @Column(name = "IfDelete")
    private Integer ifDelete = 0;

    /**
     * 启用禁用状态(0：禁用/黑名单；1：启用/在聘)
     */
    @Column(name = "UseMark")
    private Integer useMark;

    /**
     * 审核状态（0：未审核；1：通过； 2:不通过）
     */
    @Column(name = "ApproveStatus")
    private Integer approveStatus;
}
